<?php



/**
 * Skeleton subclass for performing query and update operations on the 'users' table.
 *
 *
 *
 * You should add additional methods to this class to meet the
 * application requirements.  This class will only be generated as
 * long as it does not already exist in the output directory.
 *
 * @package    propel.generator.empeval
 */
class EmpevalUsersQuery extends EmpevalBaseUsersQuery
{
	
	public function withRoles() {
		$this
		->useUserRolesRelatedByToUserIdQuery(null, Criteria::LEFT_JOIN)
			->leftJoinRoles()
		->endUse()
		->with('UserRolesRelatedByToUserId')
		->with('Roles');
		return $this;
	}
	
	public function withPosition() {
		$this
		->useUserPositionsQuery(null, Criteria::LEFT_JOIN)
			->leftJoinPositions()
			->leftJoinUnits()
		->endUse()
		->addJoinCondition('UserPositions', 'UserPositions.Active = 1')
		->with('UserPositions')
		->with('Positions')
		->with('Units');
		return $this;
	}
	
	public function filterByAd($login) {
		$this
			->filterByAdLogin1($login)
			->_or()
			->filterByAdLogin2($login)
			->_or()
			->filterByAdLogin3($login)
			->filterByActive(true)
			->filterByDeleted(null, Criteria::ISNULL);
		return $this;
	}
	
}
